package com.chaihu.config.feign.webflux;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 吃土的飞鱼
 * @date 2020/12/18
 */
public class ReactiveRequestContextHolder {

    public static ThreadLocal<Map<String, String>> threadLocal = new ThreadLocal<Map<String, String>>() {
        @Override
        protected Map<String, String> initialValue() {
            return new HashMap<String, String>();
        }
    };

    public static String put(String key, String value) {
        return threadLocal.get().put(key, value);
    }

    public static String get(String key) {
        return threadLocal.get().get(key);
    }

    public static String remove(String key) {
        return threadLocal.get().remove(key);
    }

    public static Map<String, String> entries() {
        return threadLocal.get();
    }
}
